package main

import (
	"github.com/gin-gonic/gin"
	"tansi/gin_proj/blogger/controller"
	"tansi/gin_proj/blogger/dao/db"
)

func main(){
	router := gin.Default()
	dns := "root:root@tcp(localhost:3306)/blogger?parseTime=true"
	err := db.Init(dns)
	if err != nil{
		panic(err)
	}
	// 加载静态文件
	router.Static("/static","./static")
	// 加载模板
	router.LoadHTMLGlob("views/*")
	router.GET("/",controller.IndexHandle)
	router.GET("/category/", controller.CategoryList)

	_ = router.Run(":8000")
}